package com.youhp.spire.xls.demo.Workbook;

import com.spire.xls.*;

import java.util.Date;

public class AddCustomProperties {
    public static void main(String[] args) {
        String inputFile = "data/ExcelSampleN.xlsx";
        String outputFile = "output/AddCustomProperties_out.xlsx";

        //Create a workbook and load a file
        Workbook workbook = new Workbook();
        workbook.loadFromFile(inputFile);

        //Add a custom property ro make the document as final
        workbook.getCustomDocumentProperties().add("_MarkAsFinal", true);

        //Add other custom properties to the workbook
        workbook.getCustomDocumentProperties().add("The Editor", "E-iceblue");
        workbook.getCustomDocumentProperties().add("Phone number", 81705109);
        workbook.getCustomDocumentProperties().add("Revision number", 7.12);
        workbook.getCustomDocumentProperties().add("Revision date", new Date());

        //Save the Excel file
        workbook.saveToFile(outputFile, FileFormat.Version2010);
    }
}
